home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pas_all.zip / TI435.ASC < prev    next >
Text File  |  1992-08-12  |  5KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  TURBO PASCAL FOR THE MACINTOSH         NUMBER  :  435
  9.   VERSION  :  1.00a/1.1
  10.        OS  :  SYSTEM 4.2/FINDER 6.0 OR LATER
  11.      DATE  :  MAY 5, 1988                              PAGE  :  1/3
  12.  
  13.     TITLE  :  HIERARCHICAL MENUS
  14.  
  15.  
  16.  
  17.  
  18.   Hierarchical menus are a new feature implemented in System/Finder
  19.   4.2/6.0  or  higher.  This feature allows you to create pull down
  20.   windows  that  have  a selection which opens  another  pull  down
  21.   window to the right (or left) side of the current pull down. This
  22.  
  23.   1)   To  create  a  hierarchical  menu  option,  add  a new  MENU
  24.        resource to your resource file with an ID between 0 and 253.
  25.        Insert  the  resource  into  the  MenuList   (you   can  use
  26.        MenuList[x] := GetMenu(y)).
  27.  
  28.   2)   Since the  selection to open a hierarchical menu cannot have
  29.        a check mark or Command Key to access it, you  utilize these
  30.        fields to denote a hierarchical menu.
  31.  
  32.   3)   You need to set the Command Key field of the  menu selection
  33.        that connects the pull  down  with  the hierarchical menu to
  34.        $1B.  This  can  be done with the  SetItemCmd  procedure  as
  35.        follows:
  36.  
  37.   SetItemCmd ( MenuList [ MenuNumber ], ItemNumber, Chr ($1B) );
  38.  
  39.        or if you are using version 1.00a of Turbo Pascal,  you must
  40.        modify the menu selection in the resource file  to  end with
  41.        /\1B as follows:
  42.  
  43.   Hierarchical Menu/\1B
  44.  
  45.        MenuNumber  is  the  number  of  the pull down  window  that
  46.        activates the hier. menu.  ItemNumber  is  the number of the
  47.        selection in the above mentioned pull down to open the hier.
  48.        menu.
  49.  
  50.   4)   Set  the  Item  Mark  field   to  the  resource  ID  of  the
  51.        hierarchical menu. Use the SetItemMark command as follows:
  52.  
  53.   SetItemMark ( MenuList [MenuNum], ItemNum, Chr (ResourceID) );
  54.  
  55.        Where MenuNum is  the  same as MenuNumber above, and ItemNum
  56.        is the same as ItemNumber above.
  57.  
  58.   5)   Insert the menu with  a  -1 to indicate it is a Hierarchical
  59.        menu.  Use the InsertMenu procedure to do this as follows:
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  TURBO PASCAL FOR THE MACINTOSH         NUMBER  :  435
  75.   VERSION  :  1.00a/1.1
  76.        OS  :  SYSTEM 4.2/FINDER 6.0 OR LATER
  77.      DATE  :  MAY 5, 1988                              PAGE  :  2/3
  78.  
  79.     TITLE  :  HIERARCHICAL MENUS
  80.  
  81.  
  82.  
  83.  
  84.   InsertMenu ( MenuList [HierMenuNum], -1 );
  85.  
  86.        When you highlight  the  pull down window selection with the
  87.        black triangle, the Hierarchical Menu you defined will open.
  88.  
  89.        Steps to modify the MyDemo program  to  include Hierarchical
  90.        Menus:
  91.  
  92.    1)  Open the MyDemo.R file
  93.  
  94.    2)  Find the MENU resource, ID 1004
  95.  
  96.    3)  a.   Append new lines after Check Mark as follows:
  97.  
  98.             Hierarchical
  99.  
  100.                  ,100
  101.             Hierarchical Menu
  102.             Choice One
  103.             Choice Two
  104.  
  105.        b.   In accordance with the note  above,  if  you  are using
  106.             Turbo Pascal version 1.00a, change  the  first  line of
  107.             the above changes to read as follows:
  108.  
  109.             Hierarchical/\1B
  110.  
  111.    4)  Save and use RMaker to compile
  112.  
  113.    5)  Open MyDemo.Pas
  114.  
  115.    6)  Modify constant MenuCnt to equal 6, not 5
  116.  
  117.    7)  Add new constants:
  118.  
  119.             HierMenu = 100; { Resource ID of Hierarchical Menu }
  120.             HM       = 6;   { Index into MenuList for Apple Menu }
  121.  
  122.  
  123.    8)  Go down to procedure Initialize
  124.  
  125.    9)  a.   After the line
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  TURBO PASCAL FOR THE MACINTOSH         NUMBER  :  435
  141.   VERSION  :  1.00a/1.1
  142.        OS  :  SYSTEM 4.2/FINDER 6.0 OR LATER
  143.      DATE  :  MAY 5, 1988                              PAGE  :  3/3
  144.  
  145.     TITLE  :  HIERARCHICAL MENUS
  146.  
  147.  
  148.  
  149.  
  150.                  MenuList[DM] := GetMenu (DiskMenu);
  151.  
  152.             Add:
  153.  
  154.             MenuList[HM] := GetMenu (HierMenu);
  155.             SetItemCmd ( MenuList [DM], 7, Chr ($1B) );
  156.             SetItemMark ( MenuList [DM], 7, Chr ( HierMenu ) );
  157.  
  158.        b.   In accordance with the note  above,  if  you  are using
  159.             Turbo  Pascal version 1.00a, do not add the second line
  160.             (SetItemCmd...).
  161.  
  162.   10)  Change the statement:
  163.             for Indx := 1 to MenuCnt do
  164.        To:
  165.             for Indx := 1 to (MenuCnt - 1) do
  166.  
  167.   11)  On the line before 'DrawMenuBar;' insert the following line:
  168.  
  169.             InsertMenu (MenuList[HM], -1);
  170.  
  171.   12)  Save the modified file and recompile the program
  172.  
  173.   DISCLAIMER: You  have the right to use this technical information
  174.   subject to the terms  of  the  No-Nonsense License Statement that
  175.   you received with  the  Borland product to which this information
  176.   pertains.
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.